from django.test import TestCase

from redis import StrictRedis

conn = StrictRedis(host='127.0.0.1', port=6379, db=0)
# res = conn.sadd('xiaoming', 18)
# conn.sadd('xiaoming', 19)
# conn.sadd('xiaoming', 20)
# print(res)
# print(conn.smembers('xiaoming'))
# li = [18, 19]
# conn.srem('xiaoming', *li)
# print(conn.smembers('xiaoming'))


# conn.hset('tom', 'gender', 1)
# d = {'3': 1, '5': 2}
# conn.hmset('c', d)
# d = conn.hgetall('c')
# print(conn.hgetall('c'))
#
# d2 = {}
# for k, v in d.items():
#     d2[int(k)] = int(v)
# #     # print(k, v)
# print(d2)

# print(conn.hkeys('c'))
# print(conn.hvals('c'))

conn.lpush('m', 1)
conn.lpush('m', 2)
conn.lpush('m', 3)
print(conn.lrange('m', 0, -1))
